package cn.drenal.capcap.mapper;

import cn.drenal.capcap.entity.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 评论Mapper接口
 */
@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    
    /**
     * 获取指定月份的评论数量
     *
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return 评论数量
     */
    @Select("SELECT COUNT(*) FROM comment WHERE create_time >= #{startDate} AND create_time < #{endDate}")
    long countCommentsByDateRange(String startDate, String endDate);
}